#include <iostream> 
#include <vector> 
#include <string> 
using namespace std; 

int main(){ 
  string str;
  cin >> str;
  bool cor=true;
  vector<char> v;
  for(int i=0; i<str.size(); i++){
    if(str[i]=='(' or str[i]=='[' or str[i]=='{' or str[i]=='<'){
      v.push_back(str[i]);
    }
    if(str[i]==')' or str[i]==']' or str[i]=='}' or str[i]=='>'){
      if(v.size()==0){
        cor=false;
        break;
      }
      else if(str[i]-v[v.size()-1]==2 or str[i]-v[v.size()-1]==1){
        v.pop_back();
      }
      else{
        cor=false;
        break;
      }
    }
  }
  if(cor==true and v.size()==0){
    cout << "True";
  }
  else{
    cout << "False";
  }
}